<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%--使用taglib 引入标签库--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/pintuer.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/admin.css">
    <script src="<%=request.getContextPath()%>/js/jquery.js"></script>
    <script src="<%=request.getContextPath()%>/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="../user_search/volunteer" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 用户列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <%-- <li> <a class="button border-main icon-plus-square-o" href"> 添加用户</a> </li> --%>
                <li>搜索：</li>

                <li>
                    <input type="text" placeholder="搜索：姓名" name="username" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <input type="text" placeholder="搜索：志愿者ID" name="vol_id" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <input type="text" placeholder="搜索：性别" name="sex" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <input type="text" placeholder="搜索：专业和班级" name="majorclass" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <a href="javascript:void(0)" class="button border-main icon-search" onclick="changeSearch()" > 搜索</a></li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th>用户ID</th>
                <th>志愿者ID</th>
                <th>姓名</th>
                <th>性别</th>
                <th>手机号码</th>
                <th>电子邮箱</th>
                <th>专业和班级</th>
                <th>个人简介</th>
                <th>操作</th>
            </tr>
            <%--使用JSTL标签库的迭代标签输出userlist集合的元素--%>
            <c:forEach var="item" items="${userList}" >

            <tr>
                <td>${item.id}</td>
                <td>${item.volId}</td>
                <td>${item.name}</td>
                <td>${item.sex}</td>
                <td>${item.phone}</td>
                <td>${item.email}</td>
                <td>${item.majorclass}</td>
                <td>${item.caption}</td>
                <td>
                    <div class="button-group">
                    <a class="button border-main" href="javascript:void(0)" onclick="resetInfo('${item.id}')"><span class="icon-edit"></span> 重置信息</a>
                    <a class="button border-main" href="javascript:void(0)" onclick="resetPassword('${item.id}')"><span class="icon-edit"></span> 重置密码</a>
                    <a class="button border-red" href="javascript:void(0)" onclick="deleteUser('${item.id}')"><span class="icon-trash-o"></span> 删除</a>
            </tr>
            </c:forEach>
        </table>
        <c:if test="${userList.size()==0}">
            <div class="alert alert-yellow">
		        <span class="close rotate-hover"></span><strong>提示：</strong>没有符合条件的志愿者
            </div>
        </c:if>
        <!--分页-->
        <%-- <div class="pagelist">
         <a href="">上一页</a> <span class="current">1</span>
         <a href="">2</a><
         a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div> --%>
    </div>
</form>
<script type="text/javascript">
function changeSearch() {
    $("#listform").submit();
}

function resetInfo(id) {
    if(!confirm("确定要重置该用户的信息吗？")) {
        return;
    }
    location.href="../user_info_reset/volunteer/" + id;
}

function resetPassword(id) {
    if(!confirm("确定要重置该用户的密码为 123456 吗？")) {
        return;
    }
    location.href="../user_pwd_reset/volunteer/" + id;
}

function deleteUser(id) {
    if(!confirm("确定要删除该用户吗？")) {
        return;
    }
    location.href="../user_delete/volunteer/" + id;
}
</script>
</body>
</html>